Skip to content

fix(UI): refactor tree api to return all parent tree#1169

Merged
genedna merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main
Jun 27, 2025
Merged

fix(UI): refactor tree api to return all parent tree#1169
genedna merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main

Conversation

@benjamin-747

Copy link
Copy Markdown
Collaborator

No description provided.

@vercel

vercel Bot commented Jun 26, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 0:34am

@benjamin-747
benjamin-747 requested a review from genedna June 27, 2025 01:04
@benjamin-747 benjamin-747 self-assigned this Jun 27, 2025
@benjamin-747 benjamin-747 added rust Pull requests that update Rust code ui labels Jun 27, 2025
@genedna
genedna requested a review from Copilot June 27, 2025 06:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the tree API to return complete parent tree information. Key changes include renaming and enhancing type definitions for tree responses, updating API handler signatures to use references instead of owned paths, and modifying the API router logic to build a comprehensive file tree structure.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
moon/packages/types/generated.ts Renamed and updated tree-related types to support parent tree responses
mono/src/api/mod.rs Changed api_handler parameter type from PathBuf to &Path
mono/src/api/api_router.rs Updated tree endpoints to build and return a TreeResponse structure
ceres/src/model/git.rs Added TreeResponse and FileTreeItem types consistent with new API design
ceres/src/api_service/mod.rs Refactored get_tree_info to use &Path and a mapping transformation

Comment on lines +146 to +159
let mut current = String::new();
let mut segments = query.path.split('/').peekable();

while let Some(segment) = segments.next() {
if segment.is_empty() {
current = "/".to_string();
parts.push(current.clone());
} else if segments.peek().is_some() {
if current != "/" {
current.push('/');
}
current.push_str(segment);
parts.push(current.clone());
}

Copilot AI Jun 27, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider normalizing the path segments to handle edge cases such as multiple consecutive slashes, ensuring that the generated 'parts' accurately represent the intended file path hierarchy.

Suggested change
let mut current = String::new();
let mut segments = query.path.split('/').peekable();
while let Some(segment) = segments.next() {
if segment.is_empty() {
current = "/".to_string();
parts.push(current.clone());
} else if segments.peek().is_some() {
if current != "/" {
current.push('/');
}
current.push_str(segment);
parts.push(current.clone());
}
let normalized_path = PathBuf::from(query.path);
for component in normalized_path.components() {
let part = component.as_os_str().to_string_lossy().to_string();
parts.push(part);

Copilot uses AI. Check for mistakes.
Comment thread ceres/src/api_service/mod.rs
@genedna
genedna added this pull request to the merge queue Jun 27, 2025
Merged via the queue into gitmono-dev:main with commit 48ae58d Jun 27, 2025
13 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants